home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Software / Freeware / Programare / bluej / bluejsetup-203.exe / {app} / examples / people2 / Address.java next >
Text File  |  2004-12-19  |  948b  |  43 lines

  1. /**
  2.  * Class Address - used to store address details for a post address
  3.  * 
  4.  * @author  Michael Kolling
  5.  * @version 1.0, January 1999
  6.  */
  7. public class Address
  8. {
  9.     private String street;
  10.     private String town;
  11.     private String postCode;
  12.     private String country;
  13.  
  14.     /**
  15.      * Construct an Address without country
  16.      */
  17.     public Address(String street, String town, String postCode)
  18.     {
  19.         this(street, town, postCode, "");
  20.     }
  21.  
  22.     /**
  23.      * Construct an Address with full details
  24.      */
  25.     public Address(String street, String town, String postCode, String country)
  26.     {
  27.         this.street = street;
  28.         this.town = town;
  29.         this.postCode = postCode;
  30.         this.country = country;
  31.     }
  32.  
  33.     /**
  34.      * Return a string representation of this object.
  35.      */
  36.     public String toString()
  37.     {
  38.         return street + "\n" +
  39.                town + " " + postCode + "\n" +
  40.                country + "\n";
  41.     }
  42. }
  43.